#coding:utf-8
import re 
print(re.search(r'[Hh]appy','I am happy today!'))
print(re.search(r'[a-d]+?','qwerabcd'))
print(re.search(r'[1-5]','abc98765abc'))
print(re.findall(r'[0-9a-zA-Z]','!@#Yf827'))
s = 'I like Python,I like Java.'
#要匹配 I like Python 和I like Java
print(re.findall(r'I like Python|Java',s))
print(re.findall(r'I like Python|I like Java',s))
print(re.findall(r'I like (Python|Java)',s))
#使用非捕获组(?:) 匹配规则，但是不获取()中的字符串，而是获取整个
print(re.findall(r'I like (?:Python|Java)',s))